In order to efficiently transmit or record moving images, a moving image coding apparatus (image coding apparatus) which generates coded data by coding a moving image, and a moving image decoding apparatus (image decoding apparatus) which generates a decoded image by decoding the coded data, are used.
As a specific moving image coding method, for example, there are methods (NPL 1) proposed in H.264/MPEG-4. AVC, and High-Efficiency Video Coding (HEVC) which is a succeeding codec thereof.
In such moving image coding methods, an image (picture) forming a moving image is managed in a layer structure which is constituted by a slice obtained by dividing the image, a coding unit obtained by dividing the slice, and a block and a partition obtained by dividing the coding unit, and the image is commonly coded and decoded for each block.
In addition, in these coding methods, typically, a predicted image is generated on the basis of a local coded image obtained by coding and decoding an input image, and coding is performed on a transform coefficient which is obtained by performing frequency transform such as discrete cosine transform (DCT) on a difference image (also referred to as a “residual image” or “prediction residual” in some cases) between the predicted image and the input image for each block.
As a specific method of coding a transform coefficient, context-based adaptive variable length coding (CAVLC) and context-based adaptive binary arithmetic coding (CABAC) are known.
In CAVLC, a one-dimensional vector is generated by sequentially scanning each transform coefficient, and syntax indicating a value of each transform coefficient, syntax indicating a length (also referred to as a run) of consecutive 0s, and the like are coded.
In CABAC, a binarization process is performed on various syntax elements indicating a transform coefficient, and binary data obtained through the binarization process is arithmetically coded. Here, the various syntax elements include a flag indicating whether or not a transform coefficient is 0, that is, a flag significant_coeff_flag (also referred to as transform coefficient presence/absence flag) indicating whether or not non-zero transform coefficient is present, syntax elements last_significant_coeff_x and last_significant_coeff_y indicating a position of the last non-zero transform coefficient in a process order, and the like.
In addition, in CABAC, when a single symbol (also referred to as 1 bit of binary data, or a Bin) is coded, a context index assigned to a process target frequency component is referred to, and arithmetic coding is performed corresponding to probability of occurrence indicated by a probability state index included in a context variable designated by the context index. In addition, the probability of occurrence designated by the probability state index is updated whenever a single symbol is coded.
In addition, in NPL 1, two-layer coding is employed as a method of coding a non-zero transform coefficient. In the two-layer coding, the transform unit is split into a plurality of sub-blocks, a flag (significant_coeff_flag) indicating whether or not a transform coefficient is non-zero is coded for each transform coefficient included in each sub-block, and a flag (also referred to as significant_coeff_group_flag, or coded_sub_block_flag) indicating whether or not a non-zero transform coefficient is included in each sub-block is coded in the sub-block units.
Further, in NPL 1, the following coding is performed in accordance with a size of the transform unit (TU). In other words, in the small TU (4×4 or 8×8), 4×4 or 8×2 is used as a sub-block size, and a context which is assigned to a frequency component is derived on the basis of a position. In the context derivation based on a position, a context index (also referred to as a position context) which is defined in accordance with a position of a frequency component in a frequency domain is assigned to the frequency component.
In addition, in the large TU (16×16, 32×32, 16×4, 4×16, 32×8, or 8×32), 4×4 is used as a sub-block size, and a context which is assigned to a frequency component on the basis of periphery reference is derived. In the context derivation based on periphery reference, a context index (also referred to as a periphery reference context) which is defined in accordance with the number of non-zero transform coefficients (that is, significant_coeff_flag is referred to) in peripheral frequency components of a corresponding frequency component is assigned to the frequency component.
In contrast, NPL 2 submits a proposal to abolish the context derivation based on periphery reference as described above, and this proposal is expected to be accepted in the next version (HM7) of an HEVC test model.
NPL 2 proposes that a derivation pattern is selected in accordance with whether or not a non-zero transform coefficient is present in an adjacent sub-block, and a context index is derived from a position in a sub-block according to the selected derivation pattern.
With reference to FIGS. 50 to 52, the proposed content in NPL 2 will be described below. In relation to a process target sub-block X illustrated in FIG. 50, the following patterns are obtained from a state of a non-zero transform coefficient in a sub-block A adjacent to the right side of the sub-block X and a sub-block B adjacent to the lower side thereof.
(Pattern 0) A case where a value of a sub-block coefficient presence/absence flag is 0 in both the right adjacent sub-block (xCG+1,yCG) and the lower adjacent sub-block (xCG,yCG+1)
(Pattern 1) A case where a value of the sub-block coefficient presence/absence flag is 1 in the right adjacent sub-block (xCG+1,yCG), a value of the sub-block coefficient presence/absence flag is 0 in the lower adjacent sub-block (xCG,yCG+1)
(Pattern 2) A case where a value of the sub-block coefficient presence/absence flag is 0 in the right adjacent sub-block (xCG+1,yCG), a value of the sub-block coefficient presence/absence flag is 1 in the lower adjacent sub-block (xCG,yCG+1)
(Pattern 3) A case where a value of the sub-block coefficient presence/absence flag is 1 in both the right adjacent sub-block (xCG+1,yCG) and the lower adjacent sub-block (xCG,yCG+1)
According to NPL 2, a pattern index idxCG indicating the patterns is obtained by using the following Equation (X).idxCG=significant_coeff_group_flag[xCG+1][yCG]+(significant_coeff_group_flag[xCG][yCG+1]<<1)  (X)
In addition, a context index is derived by using coordinates (xB,yB) in the sub-block X in a method illustrated in FIG. 51 in accordance with the pattern index idxCG. With reference to FIG. 51, description will be made of a value of a context index which is derived in each case of the patterns 0 to 3.
(Case of Pattern 0)
In a case of the pattern 0, a context index is derived by sigCtx=(xB+yB<=2)?1:0.
Values of the context index are arranged as illustrated in FIG. 52(a).
(Case of Pattern 1)
In a case of the pattern 1, a context index is derived by sigCtx=(yB<=1)?1:0.
Therefore, as illustrated in FIG. 52(b), values of the context indexes are 1 in the first and second rows of the sub-block, and values of the context indexes are 0 in the third and fourth rows of the sub-block.
(Case of Pattern 2)
In a case of the pattern 2, a context index is derived by sigCtx=(xB<=1)?1:0.
Therefore, as illustrated in FIG. 52(c), values of the context indexes are 1 in the first and second columns of the sub-block, and values of the context indexes are 0 in the third and fourth columns of the sub-block.
(Case of Pattern 3)
In a case of the pattern 3, a context index is derived by sigCtx=(xB+yB<=4)?2:1.
Therefore, in a case of the pattern 3, if a sum of the coordinate xB in the horizontal direction and the coordinate yB in the vertical direction of the coordinates (xB,yB) in the sub-block is 4 or less, a value of the context index is 1, and, otherwise, a value of the context index is 0.
Therefore, values of the context indexes are arranged as illustrated in FIG. 52(d).
In addition, NPL 3 proposes that, in an 8×8 TU, shapes of sub-blocks which are different from each other in each scan direction are unified to a 4×4 sub-block, and also in 8×8 TU to 32×32 TU, a derivation pattern is selected in accordance with whether or not a non-zero transform coefficient is present in an adjacent sub-block, and a context index regarding a transform coefficient presence/absence flag is derived from a position in the sub-block according to the selected derivation pattern. Further, according to NPL 3, a proposal is submitted that, in relation to an 8×8 TU of luminance, contexts regarding a transform coefficient presence/absence flag are differentiated from each other according to scan directions which are an up-right diagonal direction and a horizontal or vertical direction. In other words, a context is shared in a vertical scan and horizontal scan separately from a context in an up-right diagonal scan.